<p:dialog 
 xmlns="http://www.w3.org/1999/xhtml"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:p="http://primefaces.org/ui"
          xmlns:c="http://java.sun.com/jsp/jstl/core"
          xmlns:fn="http://java.sun.com/jsp/jstl/functions"
          xmlns:oso="http://osoftware.com/facelets"
		widgetVar="billDetailDialogWV" header="Detalle de Telefonos" showEffect="clip" hideEffect="clip" id="billDetailDialog">
	<h:form id="billDetailDialogForm">
		<h:panelGrid columns="3">
			<oso:selectOneMenu id="speciality"
				label="#{resourceBundle['schedule.speciality']}"
				converter="specialityConverter"
				items="#{billModel.selectableSpecialities}"
				value="#{billModel.speciality}"
				itemLabel="name">
				<p:ajax event="change"
					listener="#{billController.onSpecialityChange}"
					update="specialist" />
			</oso:selectOneMenu>
	
			<oso:selectOneMenu id="specialist"
				label="#{resourceBundle['schedule.specialist']}"
				converter="specialistConverter"
				value="#{billModel.specialist}"
				items="#{billModel.speciality.specialists}"
				itemLabel="fullName">
				<p:ajax event="change"
					update="specialistFee" />
			</oso:selectOneMenu>
			<oso:selectOneMenu id="specialistFee" 
				label="#{resourceBundle['bill.specialistFee']}"
				value="#{billModel.editedBillDetail.specialistFee}" 
				converter="specialistFeeConverter"
				items="#{billModel.specialist.fees}" 
				required="true" 
				itemLabel="description">
				<p:ajax event="change"
					listener="#{billController.onSpecialityChange}"
					update="fee" />
			</oso:selectOneMenu>
			<oso:inputText id="fee" label="#{resourceBundle['bill.fee']}"
					value="#{billModel.editedBillDetail.specialistFee.amount}">	
			</oso:inputText>
				
			<oso:spinner id="quantity" label="#{resourceBundle['billDetail.quantity']}"
				value="#{billModel.editedBillDetail.quantity}">
			</oso:spinner>
			
			<oso:inputText id="month" label="#{resourceBundle['billDetail.month']}"
				value="#{billModel.editedBillDetail.paidMonth}" />
			
			<oso:inputText id="year" label="#{resourceBundle['billDetail.year']}"
				value="#{billModel.editedBillDetail.paidYear}" />			
						
			<p:commandButton id="submitBillDetailButton" value="#{resourceBundle['btn.save']}" action="billDetailEvent"
				oncomplete="handleBillDetailServerResponse(xhr, status, args)" update=":editForm:listTable" process="billDetailDialogForm"
				execute="@this" />
			<p:commandButton value="#{resourceBundle['btn.cancel']}" oncomplete="handleBillDetailServerResponse(xhr, status, args)" process="@none"/>
		</h:panelGrid>
	</h:form>
	<script type="text/javascript">
	        function handleBillDetailServerResponse(xhr, status, args) {
	            if (!args.validationFailed) {
	            	billDetailDialogWV.hide();
	            }
	        }
	    </script>

</p:dialog>
